package com.kb.design.controller.chart;


import com.kb.design.common.ApiResponse;
import com.kb.design.dto.QueryChartDTO;
import com.kb.design.service.PerformanceService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;;
import java.util.HashMap;
import java.util.Map;

/**
 * 绩效分析
 */
@RestController
@RequestMapping("/performance")
public class PerformanceController {

    @Resource
    private PerformanceService performanceService;
    /**
     * 项目部门Pin数统计
     */
    @PostMapping("/deptProjectPinCount")
    public ApiResponse deptProjectPinCount(@RequestBody QueryChartDTO queryChartDTO) {
        //低代码太low  强行加一层
        Map<String, Object> map = new HashMap<>();
        map.put("deptProjectPinCount", performanceService.projectCount(queryChartDTO));
        return ApiResponse.success(map);
    }
    /**
     * 部门绩效
     */
    @PostMapping("/getDeptPerformance")
    public ApiResponse getDeptPerformance(@RequestBody QueryChartDTO queryChartDTO) {
        return ApiResponse.success(performanceService.getDeptPerformance(queryChartDTO));
    }

    /**
     * pin数排名
     */
    @PostMapping("/getDeptPerformanceRanking")
    public ApiResponse getDeptPerformanceRanking(@RequestBody QueryChartDTO queryChartDTO) {
        return ApiResponse.success(performanceService.getDeptPerformanceRanking(queryChartDTO));
    }

    /**
     * 交付列表
     */
    @PostMapping("/getDeliveryList")
    public ApiResponse getDeliveryList(@RequestBody QueryChartDTO queryChartDTO) {
        return ApiResponse.success(performanceService.getDeliveryList(queryChartDTO));
    }
    /**
     * 奖金分配
     */
    @PostMapping("/getBonusDistribution")
    public ApiResponse getBonusDistribution(@RequestBody QueryChartDTO queryChartDTO) {
        return ApiResponse.success(performanceService.getBonusDistribution(queryChartDTO));
    }
}
